import {RouteRecordRaw} from "vue-router";
import ACCESS_ENUM from "../access/accessEnum.ts";

export const routes: Array<RouteRecordRaw> = [
    {
        path: "/noAuth",
        name: "403",
        // @ts-ignore
        component: () => import("../view/NoAuthView.vue"),
        meta: {
            //表示是否展示在菜单导航
            isHidden: true,
        },
    },

    {
        path: "/",
        name: "商家列表",
        // @ts-ignore
        component: () => import("../view/BusinessList.vue"),
        meta: {
            //表示该页面只能允许管理员访问
            access: ACCESS_ENUM.ADMIN,
        },
    },
    {
        path: "/customerList",
        name: "用户管理",
        // @ts-ignore
        component: () => import("../view/UserList.vue"),
        meta: {
            //表示该页面只能允许管理员访问
            access: ACCESS_ENUM.ADMIN,
        },
    },
    {
        path: "/user/login",
        name: "登录",
        // @ts-ignore
        component: () => import("../view/UserLoginView.vue"),
        meta: {
            //表示是否展示在菜单导航
            isHidden: true,
        },
    },
    {
        path: "/user/register",
        name: "注册",
        // @ts-ignore
        component: () => import("../view/UserRegisterView.vue"),
        meta: {
            //表示是否展示在菜单导航
            isHidden: true,
        },
    },
    {
        path: "/analyse/businessInfo/:id",
        name: "商家数据",
        // @ts-ignore
        component: () => import("../view/BusinessDetails.vue"),
        meta: {
            //表示该页面只能允许管理员访问
            access: ACCESS_ENUM.ADMIN,
            //表示是否展示在菜单导航
            isHidden: true,
        },
        children:[
            {
                path: "foods",
                name: "商品列表",
                // @ts-ignore
                component: () => import("../components/Foods.vue"),
                meta: {
                    //表示该页面只能允许管理员访问
                    access: ACCESS_ENUM.ADMIN,
                    //表示是否展示在菜单导航
                    isHidden: true,
                }
            },
            {
                path: "orders",
                name: "订单列表",
                // @ts-ignore
                component: () => import("../components/Orders.vue"),
                meta: {
                    //表示该页面只能允许管理员访问
                    access: ACCESS_ENUM.ADMIN,
                    //表示是否展示在菜单导航
                    isHidden: true,
                }
            },
            {
                path: "datas",
                name: "数据分析",
                // @ts-ignore
                component: () => import("../components/Datas.vue"),
                meta: {
                    //表示该页面只能允许管理员访问
                    access: ACCESS_ENUM.ADMIN,
                    //表示是否展示在菜单导航
                    isHidden: true,
                }
            },

        ]
    },
    {
        path: "/foodList",
        name: "商品管理",
        props: route => ({ key: route.fullPath }),
        // @ts-ignore
        component: () => import("../view/BusinessFood.vue"),
        meta: {
            //表示该页面只能允许管理员访问
            access: ACCESS_ENUM.ADMIN,
            //表示是否展示在菜单导航
            isHidden: true,
        },
    },
    {
        path: "/orderType",
        name: "点餐类型",
        // @ts-ignore
        component: () => import("../view/OrderTypeList.vue"),
        meta: {
            //表示该页面只能允许管理员访问
            access: ACCESS_ENUM.ADMIN,
        },
    },
]
